import { SFormItem } from "@/components/common"
import StyleSelect from "@/components/common/styleSelect"
import { useLocale } from "@/locales"
// import { TableColumnType } from "antd"
// import dynamicComponent from "./dynamicImport"

export type LimitStatusField = {
	shieldStatus: number
}
export const limitStatusMap = new Map([
	[1, "label.available"],
	[0, "label.forbidden"]
])
const LimitStatus: () => { LimitStatus: JSX.Element; column: any } = () => {
	const { newFormat } = useLocale()
	const options = [
		{ label: newFormat("label.available"), value: 1 },
		{ label: newFormat("label.forbidden"), value: 0 }
	]
	// console.log(newFormat({ id: "label.demoList.0" }))
	// const DynamicComponent = lazy(() => dynamicComponent(props.name))
	return {
		LimitStatus: (
			<SFormItem name="shieldStatus" label={newFormat({ id: `label.redLimit.status` })}>
				<StyleSelect options={options} placeholder={newFormat({ id: "label.select_all" })} allowClear />
			</SFormItem>
		),
		column: {
			dataIndex: "shieldStatus",
			title: newFormat("title.templateStatus"),
			render: (text: number) => newFormat(limitStatusMap.get(text) ?? "unknow")
		}
	}
}

export default LimitStatus
